<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        th{
            text-align: left;
            font-size: 22px;
            border-bottom: solid #aaa 2px;
        }
        td{
            text-align: left;
            font-size: 20px;
            border-bottom: solid #aaa 1px;
        }
        h5{
            padding-left: 10px;
        }
    </style>
</head>

<body>
    <script>
        function getQueryString(name) {
            var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
            var r = window.location.search.substr(1).match(reg);
            if (r != null) {
                return unescape(r[2]);
            }
            return null;
        }

        var list = getQueryString('l')?JSON.parse(getQueryString('l')):null;
        var info = getQueryString('i')?JSON.parse(getQueryString('i')):null;

        if(list!=null&info!=null){
            document.write('<div style="width:58mm;border:solid 1px #ccc;padding:0px 10px;">');
            document.write('<h2 style="text-align:center">菜菜帮</h3>');
            document.write('<h4 style="">菜品</h5>');
            document.write('<table style="padding:0;margin:0;width:100%;">');
            document.write('<thead><tr><th>菜名</th><th>单价</th><th>数量</th></tr></thead><tbody>');
            
            list.map(function(v,i){
                document.write('<tr><td>'+v.n+'</td><td>'+v.p+'元</td><td>x'+v.q+'</td></tr>');
            })
                
            
            document.write('</tbody></table>');
            
            
            document.write('<h4 style="">信息</h4>');
            document.write('<table style="padding:0;margin:0;width:100%;"><tbody>');
            document.write('<tr><td width="60">联系方式：</td><td>'+info.n+'</td></tr>');
            document.write('<tr><td>总金额：</td><td>'+info.t+'</td></tr>');           
            if(info.ish=='1'){
                document.write('<tr><td>配送时间：</td><td>'+info.b+'</td></tr>');
                document.write('<tr><td>地址：</td><td>'+info.a+'</td></tr>');
                
            } 
            document.write('<tr><td>备注：</td><td>'+info.m+'</td></tr>'); 
            document.write('</tbody></table>');
            document.write('<div  style="text-align: center"><img src="QRcode.png" style="margin: 0 auto;"></div>');
            document.write('</div">');

        } else {
            alert('打印错误')
        }

    </script>
</body>

</html>